import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 苏李涛
 * Date: 2024-05-08
 * Time: 21:16
 */
public class Main {
    /**
     * 只出现一次的数字
     * @param args
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入数组长度: n");
        int n = sc.nextInt();
        int[] array = new int[n];
        System.out.println("请输入每一个元素");
        for (int i = 0; i < array.length; i++) {
            array[i] = sc.nextInt();
        }

        int ret = 0;
        for (int i = 0; i < array.length; i++) {
            ret ^= array[i];
        }
        System.out.print("只出现过一次的数字:" + ret + " ");
    }









    /**
     *两数之和
     * @param args
     */
    public static void main1(String[] args) {
        int[] array = new int[]{2,7,11,15};
        System.out.println(Arrays.toString(jude(array,9)));
    }
    public static int[] jude(int[] nums,int target) {
        for (int i = 0; i < nums.length; i++) {

            if ((nums[i] + nums[i+1]) == target) {
                return new int[]{i,i+1};
            }
        }
        return new int[0];
    }
}
